﻿#include <iostream>
using namespace std;

#include <map>
#include <string>
#include <vector>
#include <algorithm>


//单词识别
//https://www.nowcoder.com/practice/16f59b169d904f8898d70d81d4a140a0?tpId=94&tqId=31064&rp=1&ru=%2Factivity%2Foj&qru=%2Fta%2Fbit-kaoyan%2Fquestion-ranking&tPage=2
void lowcase(string& s) //小写转换
{
    for (auto& c : s)
    {
        if (c >= 'A' && c <= 'Z')
            c += 32;
    }
}

template<class K,class V>
struct Compare
{
    bool operator()(const pair<K, V>& p1, const pair<K, V>& p2)
    {
        return p1.second > p2.second
            || (p1.second == p2.second && p1.first < p2.first);
    }
};

int main() {

    string s;
    while (getline(cin,s))
    {
        map<string, int> m;
        lowcase(s);
        vector<string> v(1, string());
        int i = 0;
        for (const auto& c : s) //分割单词
        {
            if (c >= 'a' && c <= 'z')
            {
                v[i].push_back(c);
            }
            else if (c == ' ')
            {
                v.push_back(string());
                ++i;
            }
        }
        for (const auto& x : v)
        {
            ++m[x];
        }
        vector<pair<string,int>> vv;
        for (const auto& x : m)
        {
            vv.push_back(make_pair(x.first, x.second));
        }
        sort(vv.begin(), vv.end(), Compare<string, int>());
        for (const auto& x : vv)
        {
            cout << x.first << ":" << x.second << endl;
        }
    }
    return 0;
}